<?php

namespace Admin\Model;

use Think\Model;

class FeedbackModel extends Model {

    protected $trueTableName = 'tb_user_feedback';

    public function getFind($where) {
        $result = $this->where($where)->find();
        return $result;
    }

    public function getList($where, $param) {
        $count = $this->alias('a')
                ->join("left join `tb_users` as b on a.userid=b.id")
                ->where($where)
                ->count();
        $Page = new \Think\Page($count, 10, $param);
        $list = $this->alias('a')
                ->join("left join `tb_users` as b on a.userid=b.id")
                ->where($where)
                ->limit($Page->firstRow . ',' . $Page->listRows)
                ->field("a.*,b.name,b.avatar")
                ->order("createdt DESC")
                ->select();
        return array('list' => $list, 'page' => $Page->show(), 'count' => $count);
    }

}
